package cn.com.qtgl.sso.oidc.comp.config;


import cn.hutool.core.bean.BeanUtil;
import cn.melonlib.cores.commons.anno.ConfigBean;
import cn.melonlib.cores.jpa.model.bean.collections.JsonMap;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@ConfigBean(name = "sso")
public class SsoConfigReader {

    @Resource
    private SsoConfig ssoConfig;

    @Resource
    private SsoScopesConfig ssoScopesConfig;

    public JsonMap<Object> config(){
        JsonMap<Object> config=JsonMap.createMap();
        BeanUtil.copyProperties(this.ssoConfig, config,"$$beanFactory");
        JsonMap<Object> scopes=JsonMap.createMap();
        BeanUtil.copyProperties(this.ssoScopesConfig, scopes,"$$beanFactory");
        return JsonMap.createMap().append("config", config)
                .append("scopes",scopes);
    }
}
